<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script src="/socket.io/socket.io.js"></script>
    <script>
        //连接socket服务
        //参数：服务器地址
        let socket=io('http://localhost:8888');
        //在app.js中注册的send方法 负责服务器返回的数据
        socket.on('send',data=>{
            console.log(data)
        })
        socket.emit('myOtherEvent', { my: 'data' });
    </script>
</body>
</html>